package com.apes.autoparts.supplier.inheart;

import com.apes.autoparts.supplier.platform.SupplierPlatformItem;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * Created by lishikun on 2021/5/21 9:20
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = InHeartDebug.CONST_TABLE_NAME)
public class InHeartDebug extends BaseModel {
    public static final String CONST_TABLE_NAME = "in_heart_debug";
    @Id
    @Comment("流水码")
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "用心调试数据")
    private String id;

    @Comment("供应商")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_platform_item_id", referencedColumnName = "id")
    private SupplierPlatformItem supplierPlatformItem;

    @Comment("配件编码")
    @Column(name = "PJID", nullable = false)
    private int pjid;

    @Comment("零件编码(编码，规则的编码可以当作是OE)")
    @Column(name = "PJCODE", length = 50, nullable = false)
    private String pjcode;

    @Comment("制造编码(OE号，原厂)")
    @Column(name = "PJOECODE", length = 50)
    private String pjoemcode;

    @Comment("零件名称")
    @Column(name = "PJNAME", length = 40)
    private String pjname;

    @Comment("零件英文名称")
    @Column(name = "PJENAME")
    private String pjename;

    @Comment("零件车型")
    @Column(name = "PJSIZE", length = 100)
    private String pjsize;

    @Comment("产地")
    @Column(name = "PJFACTORY", length = 100)
    private String pjfactory;

    @Comment("价格")
    @Column(name = "XSPRICE", columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double xsprice;

    @Comment("库存数")
    @Column(name = "KCAMOUNT")
    private int kcamount = 0;

    @Comment("零件品牌")
    @Column(name = "PJPP", length = 20)
    private String pjpp;

    @Comment("品牌")
    @Column(name = "PJBRAND", length = 20)
    private String pjbrand;
    @Comment("品牌编码")
    @Column(name = "PPCODE", length = 20)
    private String ppcode;

    @Comment("公会编码")
    @Column(name = "GXCODE", length = 20)
    private String gxcode;

    @Comment("通用车型")
    @Column(name = "PJGENSIZE", length = 500)
    private String pjgensize;

    @Comment("互换码")
    @Column(name = "HHCODE", length = 2000)
    private String hhcode;

    @Comment("商家库存表自增ID")
    @Column(name = "KCID")
    private int kcid;

    @Comment("库号（仓库）")
    @Column(name = "KCDEPOT", length = 20)
    private String kcdepot;

}
